// 3.0.1 导入我们封装记得 wxRequest 方法
import wxRequest from '../utils/wxRequest'
// 3.0.2 导入全局路径
import appConfig from '../utils/appConfig'

// console.log('是否成功导入')
// 3.0.3 设置请求API的根路径
wxRequest.baseUrl = `${appConfig.HTTP_BAST_URL}/api/public/v1/`

// 3.0.4 封装请求API，这里的用法类似 axios
const getHomeSwiper = params => {
  return wxRequest('home/swiperdata', params).then(res => res.data)
}
const getHomeNav = params => {
  return wxRequest('home/catitems', params).then(res => res.data)
}
const getHomefloor = params => {
  return wxRequest('home/floordata', params).then(res => res.data)
}
const getGoodsDetail = params => {
  return wxRequest('goods/detail', params).then(res => res.data)
}
// 3.0.5 记得把封装的API方法导出，我们这里是统一导出
export default {
  getHomeSwiper,
  getHomeNav,
  getHomefloor,
  getGoodsDetail
}
